package com.registration.controller;


import com.registration.Annotation.OperateLog;
import com.registration.bean.MenuBean;
import com.registration.service.MenuService;
import com.registration.util.JsonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1")
@CrossOrigin
public class MenuController {

    JsonResponse jsonResponse = new JsonResponse();


    @Autowired
    MenuService menuService;


    @GetMapping("/getMenuList")
    @OperateLog("获取菜单列表")
    public JsonResponse getMenuList() {
        List<MenuBean> menuBeanList=menuService.getMenuList(0);
        if(menuBeanList!=null){
            return jsonResponse.success(menuBeanList);
        }else {
            return jsonResponse.fail("无菜单");
        }
    }


}
